package com.example.demo.TakeMaterial.controller;

import com.example.demo.TakeMaterial.service.DeliveryFormService;
import com.example.demo.common.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/TakeMaterial/DeliveryForm")
@PreAuthorize("hasAnyAuthority('1','2','4','5')")//访问权限
@CrossOrigin(origins = {"*"})//允许访问的域列表
public class DeliveryFormController {

    @Autowired
    private DeliveryFormService deliveryFormService;

    //所有的出库记录
    @GetMapping("/selectAll")
    public ResponseData selectAll()
    {
        return deliveryFormService.selectAll();

    }
    //按时间段查询导出
   @GetMapping("/selectBetweenDate")
   public ResponseData selectBetweenDate(@RequestParam("beginDate") String beginDate,@RequestParam("endDate") String endDate)
   {
       return deliveryFormService.selectBetweenDate(beginDate,endDate);
   }

   @GetMapping("/selectRequisitionId")
   public  ResponseData selectRequisitionId(@RequestParam("requisitionId") String requisitionId)
   {
       return deliveryFormService.selectRequisitionId(requisitionId);
   }
}
